//
//  TDHttpEngine.h
//  TFB
//
//  Created by Nothing on 15/3/20.
//  Copyright (c) 2015年 TD. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MKNetworkKit.h"
#import "TDUser.h"

//#define HOST @"http://59.56.73.144/mpcctp/"

typedef void(^Req_Body_complete)(BOOL succeed, NSString *msg, id reqBody);

@interface TDHttpEngine : NSObject

//初始化网络引擎
+ (instancetype)shareHttpEngine;



/**
 *  发送验证码
 *
 *  @param custMobile 手机号
 *  @param codeType   验证码类型 
 *  @param complete   block回传
 */
+ (void)requestForGetMsgCodeWithCustMobile:(NSString *)custMobile codeType:(NSString *)codeType complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;

/**
 *  验证验证码
 *
 *  @param custMobile 手机号
 *  @param codeType   验证码类型
 *  @param msgCode    验证码
 *  @param isForgetPwd 是否是找回密码
 *  @param complete   block回传
 */
+ (void)requestForVerifyMsgCodeWithCustMobile:(NSString *)custMobile codeType:(NSString *)codeType msgCode:(NSString *)msgCode isForgetPwd:(BOOL)isForgetPwd complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;

/**
 *  注册
 *
 *  @param custMobile      手机号
 *  @param custPwd         登录密码
 *  @param complete        block回传
 */
+ (void)requestForRegistWithCustMobile:(NSString *)custMobile custPwd:(NSString *)custPwd complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  登录
 *
 *  @param CustMobile 手机号
 *  @param custPwd    登录密码
 *  @param complete   block回传
 */
+ (void)requestForLoginWithCustMobile:(NSString *)custMobile custPwd:(NSString *)custPwd complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  退出登录
 *
 *  @param complete   block回传
 */
+ (void)requestForLoginoutWithCustMobile:(NSString *)custMobile custId:(NSString *)custId complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  获取首页轮播图
 *
 *  @param complete   block回传
 */
+ (void)requestForIndexPageBannerSourceWithCustMobile:(NSString *)custMobile custId:(NSString *)custId complete:(void(^)(BOOL succeed, NSString *msg, id req_body))complete;


/**
 *  商户信息查询
 *
 *  @param custMobile 手机号
 *  @param custId     商户id
 *  @param complete   block回传
 */
+ (void)requestForGetCustInfWithCustMobile:(NSString *)custMobile custId:(NSString *)custId complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod, TDUser *user))complete;

/**
 *  获取银行卡信息
 *
 *  @param custMobile 手机号
 *  @param custId     商户id
 *  @param complete   block回传
 */
+ (void)requestFor_GETCARDINFO_WithCustMobile:(NSString *)custMobile
                                       custId:(NSString *)custId
                                     complete:(Req_Body_complete)complete;

/**
 *  商户密码修改与找回
 *
 *  @param pwdType    修改的密码类型	N		密码类型：1-登录密码；2-支付密码
 *  @param updateType 修改方式	N		1：根据原密码修改；2：根据短信验证码找回
 *  @param value      短信验证码或原始密码	N
 *  @param newPwd     新密码	N
 *  @param custMobile 手机号	N
 *  @param complete   block回传
 */
+ (void)requestForUpdatePwdWithPwdType:(NSString *)pwdType updateType:(NSString *)updateType value:(NSString *)value newPwd:(NSString *)newPwd custMobile:(NSString *)custMobile complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  商户实名认证
 *
 *  @param cardHandheld 手持身份证照片	N
 *  @param cardFront    身份证正面照片	N
 *  @param cardBack     身份证背面照片	N
 *  @param custId       商户编号	N
 *  @param complete     block回传
 */
+ (void)requestForCertificationWithCardHandheld:(NSString *)cardHandheld
                                      cardFront:(NSString *)cardFront
                                       cardBack:(NSString *)cardBack
                                     activeCode:(NSString *)activeCode
                                         custId:(NSString *)custId
                                     custMobile:(NSString *)custMobile
                                       custName:(NSString *)custName
                                certificateType:(NSString *)certificateType
                                  certificateNo:(NSString *)certificateNo
                                      userEmail:(NSString *)userEmail
                                     provinceId:(NSString *)provinceId
                                         cityId:(NSString *)cityId
                                         areaId:(NSString *)areaId
                                         payPwd:(NSString *)payPwd
                                       complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  银行卡修改与绑定
 *
 *  @param operType   	操作类型	N   1-银行卡绑定；2-银行卡信息修改；3-设为默认银行卡，4-解绑(删除)
 *  @param oldCardNo  	原银行卡号	Y	当操作类型为银行卡号修改时，该字段必须为改变前的银行卡号
 *  @param cardNo     	银行卡号	N		需要绑定的银行卡号或需要变更的新卡号
 *  @param cardFront  	银行卡正面照片	Y		商户绑定或更改的银行卡正面照片
 *  @param cardBack   	银行卡正面照片	Y		商户绑定或更改的银行卡正面照片
 *  @param provinceId 	银行卡所属省份Id	Y		省份来源：服务器省市列表获取接口
 *  @param cityId     	银行卡开户城市Id	Y		城市来源：服务器省市列表获取接口
 *  @param cnapsCode  	联行号	Y		当用户可以选择到对应的联行号时上传
 *  @param complete     block回传
 */
+ (void)requestForUpBankCardWithCustId:(NSString *)custId
                            custMobile:(NSString *)custMobile
                              OperType:(NSString *)operType
                             oldCardNo:(NSString *)oldCardNo
                                cardNo:(NSString *)cardNo
                              cardName:(NSString *)cardName
                             cardFront:(NSString *)cardFront
                              cardBack:(NSString *)cardBack
                            provinceId:(NSString *)provinceId
                                cityId:(NSString *)cityId
                                areaId:(NSString *)areaId
                              bankcode:(NSString *)bankcode
                             cnapsCode:(NSString *)cnapsCode
                              complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;


/**
 *  获取省列表
 *
 *  @param custId       商户id    Y
 *  @param complete     block回传
 */
+ (void)requestForGetProvinceWithCustId:(NSString *)custId custMobile:(NSString *)custMobile complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod, NSArray *array))complete;


/**
 *  绑定终端
 *
 *  @param custId   商户id
 *  @param custId   手机号
 *  @param termNo   终端序列号
 *  @param complete block回传
 */
+ (void)requestForBDZDWithCustId:(NSString *)custId custMobile:(NSString *)custMobile termNo:(NSString *)termNo complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;



/**
 *  获取轮播图
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestForDynamicImgWithCustId:(NSString *)custId custMobile:(NSString *)custMobile complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod, NSArray *imageArray))complete;


/**
 *  商品订单(下单)
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param prdordType 订单类型	N	01收款  02商品 (便民)
 *  @param bizType    子订单类型	Y	当prdordType取值02，该字段取值：01 手机充值 02 …
 *  @param prdordAmt  订单金额
 *  @param complete   block回传
 */
+ (void)requestForPrdOrderWithCustId:(NSString *)custId custMobile:(NSString *)custMobile prdordType:(NSString *)prdordType bizType:(NSString *)bizType prdordAmt:(NSString *)prdordAmt complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod, NSDictionary *infoDic))complete;


/**
 *  获取终端列表
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestForGetTermListWithCustId:(NSString *)custId custMobile:(NSString *)custMobile complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod, NSArray *termArray))complete;


/**
 *  设备签到，获取秘钥
 *
 *  @param custMobile 手机号
 *  @param termNo     设备号
 *  @param termType   设备类型
 *  @param custId     商户id
 *  @param complete   block回传
 */
+ (void)requestForGetMiYaoWithCustMobile:(NSString *)custMobile termNo:(NSString *)termNo termType:(NSString *)termType custId:(NSString *)custId complete:(void(^)(BOOL succeed, NSString *msg, NSDictionary *diction))complete;


/**
 *  支付
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param prdordNo   订单号
 *  @param payType    支付方式
 *  @param rate       费率类型
 *  @param termNo     终端号
 *  @param termType   终端类型
 *  @param payAmt     交易金额
 *  @param track      磁道信息
 *  @param pinblk     密码密文
 *  @param random     随机数	C		音频设备时使用
 *  @param mediaType  介质类型	C		01 磁条卡 02 IC卡
 *  @param period     有效期	C		mediaType 02时必填
 *  @param icdata     55域	C		mediaType 02时必填
 *  @param crdnum     卡片序列号	C		mediaType 02时必填
 *  @param mac        Mac	C		设备计算的mac
 *  @param complete   block回传
 */
+ (void)requestForPayWithCustId:(NSString *)custId custMobile:(NSString *)custMobile prdordNo:(NSString *)prdordNo payType:(NSString *)payType rate:(NSString *)rate termNo:(NSString *)termNo termType:(NSString *)termType payAmt:(NSString *)payAmt track:(NSString *)track pinblk:(NSString *)pinblk random:(NSString *)random mediaType:(NSString *)mediaType period:(NSString *)period icdata:(NSString *)icdata crdnum:(NSString *)crdnum mac:(NSString *)mac complete:(void(^)(BOOL succeed, NSString *msg, NSString *cod))complete;

#pragma mark - 交易
/**
 *  交易记录
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param start      开始取记录的行号
 *  @param pageSize   要取出记录数
 *  @param complete   block回传
 */
+ (void)requestFor_GETTRANSERIALLIST_WithCustId:(NSString *)custId
                                     custMobile:(NSString *)custMobile
                                          start:(NSUInteger)start
                                       pageSize:(NSUInteger)pageSize
                                       complete:(Req_Body_complete)complete;

/**
 *  交易记录详情
 *
 *  @param custId     商户id 
 *  @param custMobile 手机号
 *  @param start      开始取记录的行号
 *  @param payordno   在交易记录查询中，有返回支付编号payordno
 *  @param complete   block回传
 */
+ (void)requestFor_GETTRANDETAIL_WithCustId:(NSString *)custId
                                 custMobile:(NSString *)custMobile
                                   payordno:(NSString *)payordno
                                   complete:(Req_Body_complete)complete;

/**
 *  商品订单（下单）
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param prdordType 商品类型 01百货商店 02 航空公司 03 大型景区售票
 *  @param prdordAmt  订单金额
 *  @param complete   block回传
 */
+ (void)requestFor_PARORDER_WithCustId:(NSString *)custId
                            custMobile:(NSString *)custMobile
                            prdordType:(NSString *)prdordType
                             prdordAmt:(NSString *)prdordAmt
                              complete:(Req_Body_complete)complete;

/**
 *  公告查询
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param start      开始取记录的行号
 *  @param pageSize   要取出记录数
 *  @param complete   block回传
 */
+ (void)requestFor_NOTICE_WithCustId:(NSString *)custId
                          custMobile:(NSString *)custMobile
                               start:(NSUInteger)start
                            pageSize:(NSUInteger)pageSize
                              lastId:(NSString *)lastId
                            complete:(Req_Body_complete)complete;

/**
 *  获取支持的银行名称列表
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestFor_GETBANKNAME_WithCustId:(NSString *)custId
                               custMobile:(NSString *)custMobile
                                 complete:(Req_Body_complete)complete;

/**
 *  快速提款
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestFor_QUICK_WITHDRAW_WithCustId:(NSString *)custId
                                  custMobile:(NSString *)custMobile
                                    complete:(Req_Body_complete)complete;

/**
 *  最新公告查询
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestFor_GETLATESTNOTICE_WithCustId:(NSString *)custId
                                  custMobile:(NSString *)custMobile
                                      lastId:(NSString *)lastId
                                    complete:(Req_Body_complete)complete;

/**
 *  我的商户
 *
 *  @param custId     商户id
 *  @param custMobile 手机号
 *  @param complete   block回传
 */
+ (void)requestFor_GETMYMERCHANT_WithCustId:(NSString *)custId
                                 custMobile:(NSString *)custMobile
                                   complete:(Req_Body_complete)complete;

/**
 *  监测更新
 *
 *  @param appVersion     版本
 *  @param appPlatform    平台
 *  @param complete   block回传
 */
+ (void)requestFor_CHECKVERSION_WithCustId:(NSString *)custId
                                custMobile:(NSString *)custMobile
                                appVersion:(NSString *)appVersion
                               appPlatform:(NSString *)appPlatform
                                  complete:(Req_Body_complete)complete;

@end
